package cc.rengu.igas.momp.core.service.trans;

import cc.rengu.igas.momp.common.constant.CommonConstant;
import cc.rengu.igas.momp.common.dao.*;
import cc.rengu.igas.momp.common.dao.impl.*;
import cc.rengu.igas.momp.common.entity.*;
import cc.rengu.igas.momp.common.enums.*;
import cc.rengu.igas.momp.common.model.bean.*;
import cc.rengu.igas.momp.common.util.CommonMessageCheck;
import cc.rengu.igas.momp.common.util.JsonOperation;
import cc.rengu.igas.momp.facade.bean.*;
import cc.rengu.igas.momp.facade.request.QueryMoneyOffMcDetailInfoRequest;
import cc.rengu.igas.momp.facade.response.QueryMoneyOffMcDetailInfoResponse;
import cc.rengu.oltp.service.base.RadpService;
import cc.rengu.oltp.service.common.constant.TreeNodeConstant;
import cc.rengu.oltp.service.common.enums.ChannelEnum;
import cc.rengu.oltp.service.common.enums.OltpRpcdEnum;
import cc.rengu.oltp.service.model.BizException;
import cc.rengu.oltp.service.model.BizResponse;
import cc.rengu.oltp.utility.bean.PageInfo;
import cc.rengu.oltp.utility.bean.PageResult;
import cc.rengu.oltp.utility.util.ConvertUtil;
import cc.rengu.oltp.utility.util.XmlTreeUtil;
import cc.rengu.utility.base.StringUtil;

import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 减免类营销活动详情查询功能实现
 *
 * @author Jinan Liu
 * @date 2020/3/24 15:20
 */
public class QueryMoneyOffMcDetailInfoService extends RadpService {

    private String globalInstId;
    private String globalQueryType;
    private String globalQueryRole;
    private String globalQueryId;
    private String globalQueryOrgId;
    private String globalMcNo;

    @Override
    protected int bizInit(String s) {
        return CommonConstant.PROCESS_SUCCESS;
    }

    @Override
    protected int bizProcess(String s, int i) {

        XmlTreeUtil xmlTreeUtil = new XmlTreeUtil();

        try {

            QueryMoneyOffMcDetailInfoRequest queryMoneyOffMcDetailInfoRequest = new QueryMoneyOffMcDetailInfoRequest();
            ConvertUtil.convertOutput(queryMoneyOffMcDetailInfoRequest);

            QueryMoneyOffMcDetailInfoResponse queryMoneyOffMcDetailInfoResponse = new QueryMoneyOffMcDetailInfoResponse();
            queryMoneyOffMcDetailInfoResponse.setHeader(queryMoneyOffMcDetailInfoRequest.getHeader());
            BizResponse<QueryMoneyOffMcDetailInfoResponse> bizResponse = new BizResponse<>();
            bizResponse.setResult(queryMoneyOffMcDetailInfoResponse);

            String timeStamp = new SimpleDateFormat(CommonConstant.TIMESTAMP_FORMAT).format(new Date());
            globalQueryType = queryMoneyOffMcDetailInfoRequest.getQueryType();
            globalQueryId = queryMoneyOffMcDetailInfoRequest.getQueryId();
            globalQueryOrgId = queryMoneyOffMcDetailInfoRequest.getQueryOrgId();
            globalQueryRole = queryMoneyOffMcDetailInfoRequest.getQueryRole();
            globalInstId = queryMoneyOffMcDetailInfoRequest.getHeader().getInstId();
            globalMcNo = queryMoneyOffMcDetailInfoRequest.getMcNo();
            rglog.info("机构<{}>在<{}>由<{}>开始查询减免类营销活动详细信息流程", globalInstId, timeStamp, globalQueryId);

            /* 报文检查 */
            CommonMessageCheck.checkBizMessageHeader(globalQueryType, globalQueryId, globalQueryRole, rglog);

            /* 检查操作员所属机构号 */
            if (StringUtil.isNullorEmpty(globalQueryOrgId)) {
                rglog.error("法人机构号<{}>的操作员<{}>的所属机构为空!", globalInstId, globalQueryId);
                throw new BizException(RespCodeEnum.MSG_VALID_CHECK_ERROR.getRespCode(), RespCodeEnum.MSG_VALID_CHECK_ERROR.getRespDesc());
            }

            /* 检查营销活动编号 */
            if (StringUtil.isNullorEmpty(globalMcNo)) {
                rglog.error("法人机构号<{}>的操作员<{}>的营销活动编号为空!", globalInstId, globalQueryId);
                throw new BizException(RespCodeEnum.MSG_VALID_CHECK_ERROR.getRespCode(), RespCodeEnum.MSG_VALID_CHECK_ERROR.getRespDesc());
            }

            // 服务调用
            BizResponse<QueryMoneyOffMcDetailInfoResponse> bizResponseNew = queryMoneyOffMcDetailInfo(xmlTreeUtil, queryMoneyOffMcDetailInfoRequest, queryMoneyOffMcDetailInfoResponse);

            ConvertUtil.convertInput(bizResponseNew.getResult());

        } catch (BizException e) {
            try {
                xmlTreeUtil.setXmlTreeStringValue(TreeNodeConstant.RESP_CODE, e.getCode());
                xmlTreeUtil.setXmlTreeStringValue(TreeNodeConstant.RESP_DESC, e.getMessage());
            } catch (Exception e1) {
                rglog.error(StringUtil.ExceptionToString(e1));
            }
        } catch (Exception e) {
            rglog.error(StringUtil.ExceptionToString(e));
            try {
                xmlTreeUtil.setXmlTreeStringValue(TreeNodeConstant.RESP_CODE, OltpRpcdEnum.OLTP_PROCESS_ERROR.getRespCode());
                xmlTreeUtil.setXmlTreeStringValue(TreeNodeConstant.RESP_DESC, OltpRpcdEnum.OLTP_PROCESS_ERROR.getRespDesc());
            } catch (Exception e1) {
                rglog.error(StringUtil.ExceptionToString(e));
            }
        }

        return CommonConstant.PROCESS_SUCCESS;
    }

    @Override
    protected int bizTerminate(String s) {
        return CommonConstant.PROCESS_SUCCESS;
    }

    /**
     * 查询减免类营销活动详细信息
     *
     * @param xmlTreeUtil                       内部XML树
     * @param queryMoneyOffMcDetailInfoRequest  减免类活动详情查询接口请求报文
     * @param queryMoneyOffMcDetailInfoResponse 减免类活动详情查询接口应答报文
     * @return cc.rengu.oltp.service.model.BizResponse<cc.rengu.igas.momp.facade.response.QueryMoneyOffMcDetailInfoResponse> 减免类活动详情查询接口应答报文
     * @throws Exception 异常信息
     * @author Jinan Liu
     * @date 2020/5/28 14:50
     */
    private BizResponse<QueryMoneyOffMcDetailInfoResponse> queryMoneyOffMcDetailInfo(XmlTreeUtil xmlTreeUtil, QueryMoneyOffMcDetailInfoRequest queryMoneyOffMcDetailInfoRequest, QueryMoneyOffMcDetailInfoResponse queryMoneyOffMcDetailInfoResponse)
            throws Exception {

        BizResponse<QueryMoneyOffMcDetailInfoResponse> bizResponse = new BizResponse<>();


        /* 判断查询类型 */
        MoMcListInfoInObj moMcListInfoInObj = new MoMcListInfoInObj();

        /* 机构编码 */
        moMcListInfoInObj.setInstId(globalInstId);

        /* 营销活动编号 */
        moMcListInfoInObj.setMcNo(globalMcNo);


        /* 先查询所有数据，在判断查询用户是否有权限获取到数据 */
        /* 根据角色权限查询数据 */
        switch (QueryTypeEnum.getByValue(globalQueryType)) {
            case BANK_QUERY_TYPE:
                /* 银行人员,需要拼接营销活动机构信息表查询 */

                /* 机构编号 */
                if (!StringUtil.isNullorEmpty(globalQueryOrgId)) {
                    moMcListInfoInObj.setOrgId(globalQueryOrgId);
                }

                /* 银行人员查询营销活动详细信息 */
                queryMoneyOffMcDetailInfoByBank(queryMoneyOffMcDetailInfoResponse, moMcListInfoInObj);

                break;

            case MCHNT_QYERY_TYPE:
                /* 商户人员,需要拼接营销活动商户信息表查询 */

                /* 根据商户编号查询商圈编号 */
                String mchntNo = globalQueryId;
                String mchntArea = null;
                TBMchntBaseInfo tbMchntBaseInfo = null;
                if (!StringUtil.isNullorEmpty(mchntNo)) {
                    /* 查询商户基本信息表 */
                    tbMchntBaseInfo = selectMompMchntBaseInfoByPrimaryKey(globalInstId, mchntNo);
                    if (null == tbMchntBaseInfo) {
                        rglog.error("查询法人机构<{}>商户<{}>基本信息失败!", globalInstId, mchntNo);
                        throw new BizException(RespCodeEnum.NO_TRANS_RECORD.getRespCode(), RespCodeEnum.NO_TRANS_RECORD.getRespDesc());
                    } else {
                        /* 商户编号 */
                        if (!StringUtil.isNullorEmpty(mchntNo)) {
                            moMcListInfoInObj.setMchntNo(mchntNo);
                        }

                        /* 商圈编号 */
                        mchntArea = tbMchntBaseInfo.getMchntArea();
                        if (!StringUtil.isNullorEmpty(mchntArea)) {
                            moMcListInfoInObj.setMchntArea(mchntArea);
                        }
                    }
                }

                /* 商户查询营销活动详细信息 */
                queryMoneyOffMcDetailInfoByMchnt(queryMoneyOffMcDetailInfoResponse, moMcListInfoInObj);

                break;

            default:
                /* 其他查询角色不支持 */
                rglog.error("当前<{}>角色的查询用户<{}>无权限操作数据!", globalQueryRole, globalQueryType);
                throw new BizException(RespCodeEnum.NO_AUTHORIZATION_TO_OPER_ERROR.getRespCode(), RespCodeEnum.NO_AUTHORIZATION_TO_OPER_ERROR.getRespDesc());
        }

        bizResponse.setRspSysId(ChannelEnum.MOMP.getChannelType());
        bizResponse.setRespCode(RespCodeEnum.TRANS_SUCCESS.getRespCode());
        bizResponse.setRespDesc(RespCodeEnum.TRANS_SUCCESS.getRespDesc());

        queryMoneyOffMcDetailInfoResponse.setRespCode(RespCodeEnum.TRANS_SUCCESS.getRespCode());
        queryMoneyOffMcDetailInfoResponse.setRespDesc(RespCodeEnum.TRANS_SUCCESS.getRespDesc());
        bizResponse.setResult(queryMoneyOffMcDetailInfoResponse);

        return bizResponse;
    }

    /**
     * 银行人员查询营销活动详细信息
     *
     * @param queryMoneyOffMcDetailInfoResponse 减免类活动详情查询接口应答报文
     * @param moMcListInfoInObj                 营销活动列表查询使用实体类入参
     * @throws Exception 异常信息
     * @author Jinan Liu
     * @date 2020/5/28 18:58
     */
    private void queryMoneyOffMcDetailInfoByBank(QueryMoneyOffMcDetailInfoResponse queryMoneyOffMcDetailInfoResponse, MoMcListInfoInObj moMcListInfoInObj) throws Exception {

        if (QueryRoleEnum.BANK_BASIC_QUERY_ROLE.getQueryRoleCode().equals(globalQueryRole) ||
                QueryRoleEnum.BANK_PUBLISH_QYERY_ROLE.getQueryRoleCode().equals(globalQueryRole)) {
            TMMcMoneyOffInfo tmMcMoneyOffInfo;

            if (QueryRoleEnum.BANK_BASIC_QUERY_ROLE.getQueryRoleCode().equals(globalQueryRole)) {

                /* 银行录入岗流程 */
                tmMcMoneyOffInfo = selectMoneyOffMcDetailInfoByBankBasicRole(moMcListInfoInObj);
                if (null == tmMcMoneyOffInfo) {
                    rglog.error("机构<{}>的减免类营销活动<{}>的基本信息查询失败!用户无权限查看数据或不存在该营销活动", globalInstId, globalMcNo);
                    throw new BizException(RespCodeEnum.GET_MONEY_OFF_MC_DETAIL_ERROR.getRespCode(), RespCodeEnum.GET_MONEY_OFF_MC_DETAIL_ERROR.getRespDesc());
                }
            } else {

                /* 银行发布岗流程 */
                tmMcMoneyOffInfo = selectMoneyOffMcDetailInfoByBankPublishRole(moMcListInfoInObj);
                if (null == tmMcMoneyOffInfo) {
                    rglog.error("机构<{}>的减免类营销活动<{}>的基本信息查询失败!用户无权限查看数据或不存在该营销活动", globalInstId, globalMcNo);
                    throw new BizException(RespCodeEnum.GET_MONEY_OFF_MC_DETAIL_ERROR.getRespCode(), RespCodeEnum.GET_MONEY_OFF_MC_DETAIL_ERROR.getRespDesc());
                }
            }

            /* 银行操作员和发布员都是从正式表查询数据,除了营销活动基本表外其他表查询语句相同 */

            /* 查询营销活动机构信息 */
            List<TMMcOrgInfo> mcOrgInfoList = getAllMcOrgListInfo();
            if (null == mcOrgInfoList || mcOrgInfoList.isEmpty()) {
                rglog.error("机构<{}>的减免类营销活动<{}>的机构信息查询失败!", globalInstId, globalMcNo);
                throw new BizException(RespCodeEnum.GET_MC_ORG_INFO_ERROR.getRespCode(), RespCodeEnum.GET_MC_ORG_INFO_ERROR.getRespDesc());
            }
            /** 收银员返现类活动详情接口去除商户信息 用户信息返回内容 */
            /* 查询营销活动商户信息 *//*
            List<Object> mcMchntInfoList = getAllMcMchntListInfo();
            */
            /* 查询营销活动用户信息 */
            List<TMMcUserInfo> mcUserInfoList = getAllMcUserListInfo();

            /* 查询营销活动时间信息 */
            List<TMMcTimeInfo> mcTimeInfoList = null;
            if (CommonConstant.SPECIFIC_TIME_SUPPORT.equals(tmMcMoneyOffInfo.getMcTimeFlag())) {
                mcTimeInfoList = getAllMcTimeListInfo();
            }
            /* 查询营销活动规则信息 */
            List<TMMcMoneyOffRuleInfo> mcMoneyOffRuleInfoList = getAllMcRuleListInfo();
            /* 查询营销活动支付产品信息 */
            List<TMMcProductInfo> mcProductInfoList = getAllMcProductListInfo();
            /* 拼接交易信息 */
            MoneyOffMcInfoBean moneyOffMcInfoBean = convertMcInfo(tmMcMoneyOffInfo);
            queryMoneyOffMcDetailInfoResponse.setMcInfoObj(moneyOffMcInfoBean);
            List<McOrgInfoBean> mcOrgInfoBeanList = mcOrgInfoList.stream().map(this::convertMcOrgInfo).collect(Collectors.toList());
            queryMoneyOffMcDetailInfoResponse.setOrgInfoList(mcOrgInfoBeanList);
            /** 营销活动详情接口去除商户信息返回内容 */
            /*
            List<McMchntInfoBean> mcMchntInfoBeanList = new ArrayList<>();
            if(null != mcMchntInfoList && !mcMchntInfoList.isEmpty()){
                mcMchntInfoBeanList = mcMchntInfoList.stream().map(this::convertMcMchntInfo).collect(Collectors.toList());
            }
            queryMoneyOffMcDetailInfoResponse.setMchntInfoList(mcMchntInfoBeanList);
            */
            if (null != mcUserInfoList && !mcUserInfoList.isEmpty()) {
                List<McUserInfoBean> mcUserInfoBeanList = mcUserInfoList.stream().map(this::convertMcUserInfo).collect(Collectors.toList());
                queryMoneyOffMcDetailInfoResponse.setUserInfoList(mcUserInfoBeanList);
            }

            if (CommonConstant.SPECIFIC_TIME_SUPPORT.equals(tmMcMoneyOffInfo.getMcTimeFlag())) {
                List<McTimeInfoBean> mcTimeInfoBeanList = new ArrayList<>();
                if (null != mcTimeInfoList && !mcTimeInfoList.isEmpty()) {
                    mcTimeInfoBeanList = mcTimeInfoList.stream().map(this::convertMcTimeInfo).collect(Collectors.toList());
                }
                queryMoneyOffMcDetailInfoResponse.setTimeInfoList(mcTimeInfoBeanList);
            }
            List<MoneyOffRuleInfoBean> mcMoneyOffRuleInfoBean = new ArrayList<>();
            if (null != mcMoneyOffRuleInfoList && !mcMoneyOffRuleInfoList.isEmpty()) {
                mcMoneyOffRuleInfoBean = mcMoneyOffRuleInfoList.stream().map(this::convertMcRuleInfo).collect(Collectors.toList());
            }
            queryMoneyOffMcDetailInfoResponse.setRuleInfoList(mcMoneyOffRuleInfoBean);
            List<McProductInfoBean> mcProductInfoBeanList = new ArrayList<>();
            if (null != mcProductInfoList && !mcProductInfoList.isEmpty()) {
                mcProductInfoBeanList = mcProductInfoList.stream().map(this::convertMcProductInfo).collect(Collectors.toList());
            }
            queryMoneyOffMcDetailInfoResponse.setProductInfoList(mcProductInfoBeanList);

        } else if (QueryRoleEnum.BANK_AUDIT_QYERY_ROLE.getQueryRoleCode().equals(globalQueryRole)) {

            /* 银行审批岗流程 */
            TMPlatBizTmp tmPlatBizTmp = selectMoneyOffMcDetailInfoByBankAuditRole(moMcListInfoInObj);
            if (null == tmPlatBizTmp) {
                rglog.error("机构<{}>的减免类营销活动<{}>的基本信息查询失败!用户无权限查看数据或不存在该营销活动", globalInstId, globalMcNo);
                throw new BizException(RespCodeEnum.GET_MONEY_OFF_MC_DETAIL_ERROR.getRespCode(), RespCodeEnum.GET_MONEY_OFF_MC_DETAIL_ERROR.getRespDesc());
            }

            /* 取临时表中所有数据 */
            List<TMPlatBizTmp> tmPlatBizTmpList = getAllMcTmpInfo(moMcListInfoInObj);
            if (null == tmPlatBizTmpList || tmPlatBizTmpList.isEmpty()) {
                rglog.error("机构<{}>的减免类营销活动<{}>的基本信息查询失败!用户无权限查看数据或不存在该营销活动", globalInstId, globalMcNo);
                throw new BizException(RespCodeEnum.GET_MONEY_OFF_MC_DETAIL_ERROR.getRespCode(), RespCodeEnum.GET_MONEY_OFF_MC_DETAIL_ERROR.getRespDesc());
            }

            /* 拆分数据 */

            /* 转换营销活动基本信息 */
            MoneyOffMcInfoBean moneyOffMcInfoBean = convertTmpMcInfo(tmPlatBizTmp);

            /* 转换营销活动机构信息 */
            List<TMPlatBizTmp> tmPlatBizTmpOrgList = tmPlatBizTmpList.stream().filter(record -> TableNameEnum.T_M_MC_ORG_INFO.getTableNameCode().equals(record.getOprTableEname())).collect(Collectors.toList());
            List<McOrgInfoBean> mcOrgInfoBeanList = tmPlatBizTmpOrgList.stream().map(this::convertTmpMcOrgInfo).collect(Collectors.toList());

            /* 查询营销活动商户信息 */
            /** 营销活动详情接口去除商户信息 用户信息返回内容 */
            /*
            List<TMPlatBizTmp> tmPlatBizTmpMchntList = tmPlatBizTmpList.stream().filter(record -> TableNameEnum.T_M_MC_MCHNT_INFO.getTableNameCode().equals(record.getOprTableEname())).collect(Collectors.toList());
            List<McMchntInfoBean> mcMchntInfoBeanList = tmPlatBizTmpMchntList.stream().map(this::convertTmpMcMchntInfo).collect(Collectors.toList());
			*/

            /* 查询营销活动用户信息 */
            List<McUserInfoBean> mcUserInfoBeanList = new ArrayList<>();
            if (CommonConstant.SPECIFIC_CLIENT_SUPPORT.equals(moneyOffMcInfoBean.getClientRange())) {
                List<TMPlatBizTmp> tmPlatBizTmpUserList = tmPlatBizTmpList.stream().filter(record -> TableNameEnum.T_M_MC_USER_INFO.getTableNameCode().equals(record.getOprTableEname())).collect(Collectors.toList());
                mcUserInfoBeanList = tmPlatBizTmpUserList.stream().map(this::convertTmpMcUserInfo).collect(Collectors.toList());
            }

            /* 查询营销活动时间信息 */
            List<McTimeInfoBean> mcTimeInfoBeanList = new ArrayList<>();
            if (CommonConstant.SPECIFIC_TIME_SUPPORT.equals(moneyOffMcInfoBean.getMcTimeFlag())) {
                List<TMPlatBizTmp> tmPlatBizTmpTimeList = tmPlatBizTmpList.stream().filter(record -> TableNameEnum.T_M_MC_TIME_INFO.getTableNameCode().equals(record.getOprTableEname())).collect(Collectors.toList());
                mcTimeInfoBeanList = tmPlatBizTmpTimeList.stream().map(this::convertTmpMcTimeInfo).collect(Collectors.toList());

            }

            /* 查询营销活动规则信息 */
            List<TMPlatBizTmp> tmPlatBizTmpRuleList = tmPlatBizTmpList.stream().filter(record -> TableNameEnum.T_M_MC_MO_RULE_INFO.getTableNameCode().equals(record.getOprTableEname())).collect(Collectors.toList());
            List<MoneyOffRuleInfoBean> moneyOffRuleInfoBeanList = tmPlatBizTmpRuleList.stream().map(this::convertTmpMcRuleInfo).collect(Collectors.toList());

            /* 查询营销活动支付产品信息 */
            List<TMPlatBizTmp> tmPlatBizTmpProdList = tmPlatBizTmpList.stream().filter(record -> TableNameEnum.T_M_MC_PROD_INFO.getTableNameCode().equals(record.getOprTableEname())).collect(Collectors.toList());
            List<McProductInfoBean> mcProductInfoBeanList = tmPlatBizTmpProdList.stream().map(this::convertTmpMcProductInfo).collect(Collectors.toList());

            /* 拼接交易信息 */
            queryMoneyOffMcDetailInfoResponse.setMcInfoObj(moneyOffMcInfoBean);
            queryMoneyOffMcDetailInfoResponse.setOrgInfoList(mcOrgInfoBeanList);
            /** 营销活动详情接口去除商户信息返回内容 */
            /*
            queryMoneyOffMcDetailInfoResponse.setMchntInfoList(mcMchntInfoBeanList);
             */
            if (CommonConstant.SPECIFIC_CLIENT_SUPPORT.equals(moneyOffMcInfoBean.getClientRange())) {
                queryMoneyOffMcDetailInfoResponse.setUserInfoList(mcUserInfoBeanList);
            }

            if (CommonConstant.SPECIFIC_TIME_SUPPORT.equals(moneyOffMcInfoBean.getMcTimeFlag())) {
                queryMoneyOffMcDetailInfoResponse.setTimeInfoList(mcTimeInfoBeanList);
            }
            queryMoneyOffMcDetailInfoResponse.setRuleInfoList(moneyOffRuleInfoBeanList);
            queryMoneyOffMcDetailInfoResponse.setProductInfoList(mcProductInfoBeanList);

        } else {
            /* 其他查询角色不支持 */
            rglog.error("当前<{}>角色的查询用户<{}>无权限操作数据!", globalQueryRole, globalQueryType);
            throw new BizException(RespCodeEnum.NO_AUTHORIZATION_TO_OPER_ERROR.getRespCode(), RespCodeEnum.NO_AUTHORIZATION_TO_OPER_ERROR.getRespDesc());
        }

    }

    /**
     * 商户查询营销活动详细信息
     *
     * @param queryMoneyOffMcDetailInfoResponse 减免类活动详情查询接口应答报文
     * @param moMcListInfoInObj                 营销活动列表查询使用实体类入参
     * @throws Exception 异常信息
     * @author Jinan Liu
     * @date 2020/5/28 19:23
     */
    private void queryMoneyOffMcDetailInfoByMchnt(QueryMoneyOffMcDetailInfoResponse queryMoneyOffMcDetailInfoResponse, MoMcListInfoInObj moMcListInfoInObj) throws Exception {

        /* 查询营销活动基本信息 */
        TMMcMoneyOffInfo tmMcMoneyOffInfo = selectMoneyOffMcDetailInfoByMchnt(moMcListInfoInObj);
        if (StringUtil.isNullorEmpty(moMcListInfoInObj.getMchntArea())) {
            tmMcMoneyOffInfo = selectMoneyOffMcDetailInfoByMchnt(moMcListInfoInObj);
        } else {
            tmMcMoneyOffInfo = selectMoneyOffMcDetailInfoByMchntWithArea(moMcListInfoInObj);
        }
        if (null == tmMcMoneyOffInfo) {
            rglog.error("机构<{}>的减免类营销活动<{}>的基本信息查询失败!商户无权限查看数据或不存在该营销活动", globalInstId, globalMcNo);
            throw new BizException(RespCodeEnum.GET_MONEY_OFF_MC_DETAIL_ERROR.getRespCode(), RespCodeEnum.GET_MONEY_OFF_MC_DETAIL_ERROR.getRespDesc());
        }

        /* 查询营销活动机构信息 */
        List<TMMcOrgInfo> mcOrgInfoList = getAllMcOrgListInfo();
        if (null == mcOrgInfoList || mcOrgInfoList.isEmpty()) {
            rglog.error("机构<{}>的减免类营销活动<{}>的机构信息查询失败!", globalInstId, globalMcNo);
            throw new BizException(RespCodeEnum.GET_MC_ORG_INFO_ERROR.getRespCode(), RespCodeEnum.GET_MC_ORG_INFO_ERROR.getRespDesc());
        }

        /* 查询营销活动商户信息 */
        /*
        List<Object> mcMchntInfoList = getAllMcMchntListInfo();
        if (null == mcMchntInfoList || mcMchntInfoList.isEmpty()) {
            rglog.error("机构<{}>的减免类营销活动<{}>的商户信息查询失败!", globalInstId, globalMcNo);
            throw new BizException(RespCodeEnum.GET_MC_MCHNT_INFO_ERROR.getRespCode(), RespCodeEnum.GET_MC_MCHNT_INFO_ERROR.getRespDesc());
        }

        /* 查询营销活动用户信息 */
        List<TMMcUserInfo> mcUserInfoList = getAllMcUserListInfo();

        /* 查询营销活动时间信息 */
        List<TMMcTimeInfo> mcTimeInfoList = null;
        if (CommonConstant.SPECIFIC_TIME_SUPPORT.equals(tmMcMoneyOffInfo.getMcTimeFlag())) {
            mcTimeInfoList = getAllMcTimeListInfo();
            if (null == mcTimeInfoList || mcTimeInfoList.isEmpty()) {
                rglog.error("机构<{}>的减免类营销活动<{}>的时间信息查询失败!", globalInstId, globalMcNo);
                throw new BizException(RespCodeEnum.GET_MC_TIME_INFO_ERROR.getRespCode(), RespCodeEnum.GET_MC_TIME_INFO_ERROR.getRespDesc());
            }
        }

        /* 查询营销活动规则信息 */
        List<TMMcMoneyOffRuleInfo> mcMoneyOffRuleInfoList = getAllMcRuleListInfo();
        if (null == mcMoneyOffRuleInfoList || mcMoneyOffRuleInfoList.isEmpty()) {
            rglog.error("机构<{}>的减免类营销活动<{}>的减免类规则查询失败!", globalInstId, globalMcNo);
            throw new BizException(RespCodeEnum.GET_MC_RULE_INFO_ERROR.getRespCode(), RespCodeEnum.GET_MC_RULE_INFO_ERROR.getRespDesc());
        }

        /* 查询营销活动支付产品信息 */
        List<TMMcProductInfo> mcProductInfoList = getAllMcProductListInfo();

        /* 拼接交易信息 */
        MoneyOffMcInfoBean moneyOffMcInfoBean = convertMcInfo(tmMcMoneyOffInfo);
        queryMoneyOffMcDetailInfoResponse.setMcInfoObj(moneyOffMcInfoBean);
        List<McOrgInfoBean> mcOrgInfoBeanList = mcOrgInfoList.stream().map(this::convertMcOrgInfo).collect(Collectors.toList());
        queryMoneyOffMcDetailInfoResponse.setOrgInfoList(mcOrgInfoBeanList);
        /** 营销活动详情接口去除商户信息返回内容 */
        /*
        List<McMchntInfoBean> mcMchntInfoBeanList = mcMchntInfoList.stream().map(this::convertMcMchntInfo).collect(Collectors.toList());
        queryMoneyOffMcDetailInfoResponse.setMchntInfoList(mcMchntInfoBeanList);
        */

        if (null != mcUserInfoList && !mcUserInfoList.isEmpty()) {
            List<McUserInfoBean> mcUserInfoBeanList = mcUserInfoList.stream().map(this::convertMcUserInfo).collect(Collectors.toList());
            queryMoneyOffMcDetailInfoResponse.setUserInfoList(mcUserInfoBeanList);
        }
        if (CommonConstant.SPECIFIC_TIME_SUPPORT.equals(tmMcMoneyOffInfo.getMcTimeFlag())) {
            if (mcTimeInfoList != null) {
                List<McTimeInfoBean> mcTimeInfoBeanList = mcTimeInfoList.stream().map(this::convertMcTimeInfo).collect(Collectors.toList());
                queryMoneyOffMcDetailInfoResponse.setTimeInfoList(mcTimeInfoBeanList);
            }
        }
        List<MoneyOffRuleInfoBean> mcMoneyOffRuleInfoBean = mcMoneyOffRuleInfoList.stream().map(this::convertMcRuleInfo).collect(Collectors.toList());
        queryMoneyOffMcDetailInfoResponse.setRuleInfoList(mcMoneyOffRuleInfoBean);
        List<McProductInfoBean> mcProductInfoBeanList = new ArrayList<>();
        if (null != mcProductInfoList && !mcProductInfoList.isEmpty()) {
            mcProductInfoBeanList = mcProductInfoList.stream().map(this::convertMcProductInfo).collect(Collectors.toList());
        }
        queryMoneyOffMcDetailInfoResponse.setProductInfoList(mcProductInfoBeanList);
    }

    /**
     * 银行操作员查询营销活动基本信息表数据(正式表)
     *
     * @param moMcListInfoInObj 营销活动列表查询使用实体类入参
     * @return cc.rengu.igas.momp.common.entity.TMMcMoneyOffInfo 减免类营销活动信息表
     * @throws Exception 异常信息
     * @author Jinan Liu
     * @date 2020/5/28 19:11
     */
    private TMMcMoneyOffInfo selectMoneyOffMcDetailInfoByBankBasicRole(MoMcListInfoInObj moMcListInfoInObj) throws Exception {
        McDetailInfoMapper mcDetailInfoMapper = new McDetailInfoMapperImpl();
        return mcDetailInfoMapper.selectMoneyOffMcDetailInfoByBankBasicRole(moMcListInfoInObj);
    }

    /**
     * 银行审批员查询营销活动基本信息表数据
     *
     * @param moMcListInfoInObj 营销活动列表查询使用实体类入参
     * @return cc.rengu.igas.momp.common.entity.TMPlatBizTmp 业务数据临时表
     * @throws Exception 异常信息
     * @author Jinan Liu
     * @date 2020/5/28 19:11
     */
    private TMPlatBizTmp selectMoneyOffMcDetailInfoByBankAuditRole(MoMcListInfoInObj moMcListInfoInObj) throws Exception {
        PlatBizTmpMapper platBizTmpMapper = new PlatBizTmpMapperImpl();
        return platBizTmpMapper.selectMoneyOffMcDetailInfoByBankAuditRole(moMcListInfoInObj);
    }

    /**
     * 银行发布员查询营销活动基本信息表数据
     *
     * @param moMcListInfoInObj 营销活动列表查询使用实体类入参
     * @return cc.rengu.igas.momp.common.entity.TMMcMoneyOffInfo 减免类营销活动信息表
     * @throws Exception 异常信息
     * @author Jinan Liu
     * @date 2020/5/28 19:11
     */
    private TMMcMoneyOffInfo selectMoneyOffMcDetailInfoByBankPublishRole(MoMcListInfoInObj moMcListInfoInObj) throws Exception {
        McDetailInfoMapper mcDetailInfoMapper = new McDetailInfoMapperImpl();
        return mcDetailInfoMapper.selectMoneyOffMcDetailInfoByBankPublishRole(moMcListInfoInObj);
    }

    /**
     * 商户查询营销活动基本信息表数据
     *
     * @param moMcListInfoInObj 营销活动列表查询使用实体类入参
     * @return cc.rengu.igas.momp.common.entity.TMMcMoneyOffInfo 减免类营销活动信息表
     * @throws Exception 异常信息
     * @author Jinan Liu
     * @date 2020/5/28 19:10
     */
    private TMMcMoneyOffInfo selectMoneyOffMcDetailInfoByMchnt(MoMcListInfoInObj moMcListInfoInObj) throws Exception {
        McDetailInfoMapper mcDetailInfoMapper = new McDetailInfoMapperImpl();
        return mcDetailInfoMapper.selectMoneyOffMcDetailInfoByMchnt(moMcListInfoInObj);
    }

    /**
     * 商户查询营销活动基本信息表数据
     *
     * @param moMcListInfoInObj 营销活动列表查询使用实体类入参
     * @return cc.rengu.igas.momp.common.entity.TMMcMoneyOffInfo 减免类营销活动信息表
     * @throws Exception 异常信息
     * @author Jinan Liu
     * @date 2020/5/28 19:10
     */
    private TMMcMoneyOffInfo selectMoneyOffMcDetailInfoByMchntWithArea(MoMcListInfoInObj moMcListInfoInObj) throws Exception {
        McDetailInfoMapper mcDetailInfoMapper = new McDetailInfoMapperImpl();
        return mcDetailInfoMapper.selectMoneyOffMcDetailInfoByMchntWithArea(moMcListInfoInObj);
    }

    /**
     * 获取营销活动机构信息列表(正式表)
     *
     * @return java.util.List<cc.rengu.igas.momp.common.entity.TMMcOrgInfo> 营销活动机构信息表
     * @throws Exception 异常信息
     * @author Jinan Liu
     * @date 2020/5/28 18:36
     */
    private List<TMMcOrgInfo> getAllMcOrgListInfo() throws Exception {

        McOrgInfoMapper mcOrgInfoMapper = new McOrgInfoMapperImpl();
        return mcOrgInfoMapper.selectMcOrgInfoList(globalInstId, globalMcNo);
    }

    /**
     * 获取营销活动商户信息列表(正式表)
     *
     * @return java.util.List<cc.rengu.igas.momp.common.entity.TMMcMchntInfo> 营销活动商户信息表
     * @throws Exception 异常信息
     * @author Jinan Liu
     * @date 2020/5/28 18:35
     */
    private List<Object> getAllMcMchntListInfo() throws Exception {
        List<Object> tmMcMchntInfoList = new ArrayList<>();
        PageInfo pageInfo = new PageInfo();
        int i = 0;
        pageInfo.setPageIndex(i);
        pageInfo.setPageSize(9999);
        TMMcMchntInfo tmMcMchntInfo = new TMMcMchntInfo();
        tmMcMchntInfo.setInstId(globalInstId);
        tmMcMchntInfo.setMcNo(globalMcNo);
        McMchntInfoMapper mcMchntInfoMapper = new McMchntInfoMapperImpl();
        PageResult tmMcMchntInfoPageInfo = mcMchntInfoMapper.selectMcMchntInfoList(tmMcMchntInfo, pageInfo);
        if (null != tmMcMchntInfoPageInfo && null != tmMcMchntInfoPageInfo.getResult()) {
            tmMcMchntInfoList.addAll(tmMcMchntInfoPageInfo.getResult());
        }
        while (null != tmMcMchntInfoPageInfo && null != tmMcMchntInfoPageInfo.getResult() && tmMcMchntInfoPageInfo.getResult().size() >= 1) {
            i++;
            pageInfo.setPageIndex(i);
            tmMcMchntInfoPageInfo = mcMchntInfoMapper.selectMcMchntInfoList(tmMcMchntInfo, pageInfo);
            if (null != tmMcMchntInfoPageInfo && null != tmMcMchntInfoPageInfo.getResult()) {
                tmMcMchntInfoList.addAll(tmMcMchntInfoPageInfo.getResult());
            }
        }
        return tmMcMchntInfoList;
    }

    /**
     * 获取营销活动用户信息列表(正式表)
     *
     * @return java.util.List<cc.rengu.igas.momp.common.entity.TMMcUserInfo> 营销活动用户信息表
     * @throws Exception 异常信息
     * @author Jinan Liu
     * @date 2020/5/28 18:38
     */
    private List<TMMcUserInfo> getAllMcUserListInfo() throws Exception {

        McUserInfoMapper mcUserInfoMapper = new McUserInfoMapperImpl();
        return mcUserInfoMapper.selectMcUserInfoList(globalInstId, globalMcNo);
    }

    /**
     * 获取营销活动时间信息列表(正式表)
     *
     * @return java.util.List<cc.rengu.igas.momp.common.entity.TMMcTimeInfo> 营销活动时间信息表
     * @throws Exception 异常信息
     * @author Jinan Liu
     * @date 2020/5/28 18:38
     */
    private List<TMMcTimeInfo> getAllMcTimeListInfo() throws Exception {

        McTimeInfoMapper mcTimeInfoMapper = new McTimeInfoMapperImpl();
        return mcTimeInfoMapper.selectMcTimeInfoList(globalInstId, globalMcNo);
    }

    /**
     * 获取营销活动规则信息列表(正式表)
     *
     * @return java.util.List<cc.rengu.igas.momp.common.entity.TMMcMoneyOffRuleInfo> 减免类营销活动规则表
     * @throws Exception 异常信息
     * @author Jinan Liu
     * @date 2020/5/28 18:40
     */
    private List<TMMcMoneyOffRuleInfo> getAllMcRuleListInfo() throws Exception {

        McRuleInfoMapper mcRuleInfoMapper = new McRuleInfoMapperImpl();
        return mcRuleInfoMapper.selectMoneyOffRuleInfoList(globalInstId, globalMcNo);
    }

    /**
     * 获取营销活动支付产品信息列表(正式表)
     *
     * @return java.util.List<cc.rengu.igas.momp.common.entity.TMMcProductInfo> 营销活动产品信息表
     * @throws Exception 异常信息
     * @author Jinan Liu
     * @date 2020/5/28 18:41
     */
    private List<TMMcProductInfo> getAllMcProductListInfo() throws Exception {

        McProductInfoMapper mcProductInfoMapper = new McProductInfoMapperImpl();
        return mcProductInfoMapper.selectMcProductInfoList(globalInstId, globalMcNo);
    }

    /**
     * 银行审批岗获取指定营销活动所有待审批数据
     * 临时表数据去除营销活动商户表数据
     *
     * @param moMcListInfoInObj 营销活动列表查询使用实体类入参
     * @return java.util.List<cc.rengu.igas.momp.common.entity.TMPlatBizTmp> 业务数据临时表
     * @throws Exception 异常信息
     * @author Jinan Liu
     * @date 2020/5/28 19:55
     */
    private List<TMPlatBizTmp> getAllMcTmpInfo(MoMcListInfoInObj moMcListInfoInObj) throws Exception {

        PlatBizTmpMapper platBizTmpMapper = new PlatBizTmpMapperImpl();
        return platBizTmpMapper.selectSingleMcDetailInfoNoMchntByBankAuditRole(moMcListInfoInObj);
    }

    /**
     * 营销活动信息数据库实体类和接口实体类数据转换
     *
     * @param mcMoneyOffInfo 减免类营销活动信息表
     * @return cc.rengu.igas.momp.facade.bean.MoneyOffMcInfoBean 减免类活动基本信息对象
     * @author Jinan Liu
     * @date 2020/4/1 10:27
     */
    private MoneyOffMcInfoBean convertMcInfo(TMMcMoneyOffInfo mcMoneyOffInfo) {
        MoneyOffMcInfoBean moneyOffMcInfoBean = new MoneyOffMcInfoBean();
        try {
            /* 营销活动编号 */
            moneyOffMcInfoBean.setMcNo(mcMoneyOffInfo.getMcNo());
            /* 营销活动名称 */
            moneyOffMcInfoBean.setMcName(mcMoneyOffInfo.getMcName());
            /* 营销活动类型 */
            moneyOffMcInfoBean.setMcType(mcMoneyOffInfo.getMcType());
            /* 营销活动状态 */
            moneyOffMcInfoBean.setMcStatus(mcMoneyOffInfo.getMcStatus());
            /* 活动起始日期 */
            moneyOffMcInfoBean.setMcStartDate(mcMoneyOffInfo.getMcStartDate());
            /* 活动截止日期 */
            moneyOffMcInfoBean.setMcEndDate(mcMoneyOffInfo.getMcEndDate());
            /* 活动结束日期 */
            moneyOffMcInfoBean.setMcActualEndDate(mcMoneyOffInfo.getMcActualEndDate());
            /* 活动时间标志 */
            moneyOffMcInfoBean.setMcTimeFlag(mcMoneyOffInfo.getMcTimeFlag());
            /* 出资方 */
            moneyOffMcInfoBean.setSponsor(mcMoneyOffInfo.getSponsor());
            /* 参与次数限制 */
            moneyOffMcInfoBean.setRestriction(mcMoneyOffInfo.getRestriction());
            /* 客户范围 */
            moneyOffMcInfoBean.setClientRange(mcMoneyOffInfo.getClientRange());
            /* 商户范围 */
            moneyOffMcInfoBean.setMerchantRange(mcMoneyOffInfo.getMerchantRange());
            /* 新增商户活动标志 */
            moneyOffMcInfoBean.setNewMchntFlag(mcMoneyOffInfo.getNewMchntFlag());
            /* 限制金额下限 */
            moneyOffMcInfoBean.setAmtLimitFloor(mcMoneyOffInfo.getAmtLimitFloor());
            /* 限制金额上限 */
            moneyOffMcInfoBean.setAmtLimitCelling(mcMoneyOffInfo.getAmtLimitCelling());
            /* 预算充值方式 */
            moneyOffMcInfoBean.setBudgetRechargeMethod(mcMoneyOffInfo.getBudgetRechargeMethod());
            /* 预算 */
            moneyOffMcInfoBean.setBudget(mcMoneyOffInfo.getBudget());
            /* 银行出资预算 */
            moneyOffMcInfoBean.setBankBudget(mcMoneyOffInfo.getBankBudget());
            /* 预期参与商户数量 */
            moneyOffMcInfoBean.setExpectMchntQty(mcMoneyOffInfo.getExpectMchntQty());
            /* 审批状态   */
            moneyOffMcInfoBean.setAuditStatus(mcMoneyOffInfo.getAuditStatus());
            /* 创建人 */
            moneyOffMcInfoBean.setOprId(mcMoneyOffInfo.getOprId());
            /* 创建时间 */
            moneyOffMcInfoBean.setCreateTime(mcMoneyOffInfo.getCreateTime());
            /* 最后修改人 */
            moneyOffMcInfoBean.setLastOprId(mcMoneyOffInfo.getLastOprId());
            /* 修改时间 */
            moneyOffMcInfoBean.setUpdateTime(mcMoneyOffInfo.getUpdateTime());
            /* 审批拒绝原因 */
            moneyOffMcInfoBean.setAuditRefuseReason(mcMoneyOffInfo.getAuditRefuseReason());
            /* 发布拒绝原因 */
            moneyOffMcInfoBean.setPublishRefuseReason(mcMoneyOffInfo.getPublishRefuseReason());
            /* 备用字段1 */
            moneyOffMcInfoBean.setRemark1(mcMoneyOffInfo.getRemark1());
            /* 备用字段2 */
            moneyOffMcInfoBean.setRemark2(mcMoneyOffInfo.getRemark2());
            /* 备用字段3 */
            moneyOffMcInfoBean.setRemark2(mcMoneyOffInfo.getRemark3());
            /* 备用字段4 */
            moneyOffMcInfoBean.setRemark2(mcMoneyOffInfo.getRemark4());
            /* 备用字段5 */
            moneyOffMcInfoBean.setRemark2(mcMoneyOffInfo.getRemark5());
            /* 强制终止原因*/
            moneyOffMcInfoBean.setNfrcTmnlRsn(mcMoneyOffInfo.getNfrcTmnlRsn());
            /* 营销活动级别 0-非商户非银行级 1 商户级 2 银行级*/
            moneyOffMcInfoBean.setMcLvlCd(mcMoneyOffInfo.getMcLvlCd());
            /* 停车场业务标志 0-非停车场业务 1停车场业务*/
            moneyOffMcInfoBean.setPrkBusnFlg(mcMoneyOffInfo.getPrkBusnFlg());
            /* 普卡优惠次数*/
            moneyOffMcInfoBean.setOdcrdDisTimes(mcMoneyOffInfo.getOdcrdDisTimes());

        } catch (Exception e) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            e.printStackTrace(new PrintWriter(byteArrayOutputStream, true));
            rglog.error("转换营销活动信息异常,异常信息:<{}>", byteArrayOutputStream.toString());
            throw new BizException(RespCodeEnum.SYSTEM_ERROR.getRespCode(), RespCodeEnum.SYSTEM_ERROR.getRespDesc());
        }

        return moneyOffMcInfoBean;
    }

    /**
     * 减免类营销活动基本信息数据库临时表实体类和接口实体类数据转换
     *
     * @param tmPlatBizTmp 业务数据临时表
     * @return cc.rengu.igas.momp.facade.bean.MoneyOffMcInfoBean 减免类活动基本信息对象
     * @author Jinan Liu
     * @date 2020/5/28 20:35
     */
    private MoneyOffMcInfoBean convertTmpMcInfo(TMPlatBizTmp tmPlatBizTmp) {
        MoneyOffMcInfoBean moneyOffMcInfoBean = new MoneyOffMcInfoBean();
        try {

            JsonTmpMoMcInfo jsonTmpMoMcInfo = JsonOperation.parseMoMcInfoTmpBizData1(tmPlatBizTmp, rglog);

            /* 营销活动编号 */
            moneyOffMcInfoBean.setMcNo(jsonTmpMoMcInfo.getMcNo());
            /* 营销活动名称 */
            moneyOffMcInfoBean.setMcName(jsonTmpMoMcInfo.getMcName());
            /* 营销活动类型 */
            moneyOffMcInfoBean.setMcType(jsonTmpMoMcInfo.getMcType());
            /* 营销活动状态 */
            moneyOffMcInfoBean.setMcStatus(jsonTmpMoMcInfo.getMcStatus());
            /* 活动起始日期 */
            moneyOffMcInfoBean.setMcStartDate(jsonTmpMoMcInfo.getMcStartDate());
            /* 活动截止日期 */
            moneyOffMcInfoBean.setMcEndDate(jsonTmpMoMcInfo.getMcEndDate());
            /* 活动结束日期 */
            moneyOffMcInfoBean.setMcActualEndDate(jsonTmpMoMcInfo.getMcActualEndDate());
            /* 活动时间标志 */
            moneyOffMcInfoBean.setMcTimeFlag(jsonTmpMoMcInfo.getMcTimeFlag());
            /* 出资方 */
            moneyOffMcInfoBean.setSponsor(jsonTmpMoMcInfo.getSponsor());
            /* 参与次数限制 */
            moneyOffMcInfoBean.setRestriction(jsonTmpMoMcInfo.getRestriction());
            /* 客户范围 */
            moneyOffMcInfoBean.setClientRange(jsonTmpMoMcInfo.getClientRange());
            /* 商户范围 */
            moneyOffMcInfoBean.setMerchantRange(jsonTmpMoMcInfo.getMerchantRange());
            /* 新增商户活动标志 */
            moneyOffMcInfoBean.setNewMchntFlag(jsonTmpMoMcInfo.getNewMchntFlag());
            /* 限制金额下限 */
            moneyOffMcInfoBean.setAmtLimitFloor(jsonTmpMoMcInfo.getAmtLimitFloor());
            /* 限制金额上限 */
            moneyOffMcInfoBean.setAmtLimitCelling(jsonTmpMoMcInfo.getAmtLimitCelling());
            /* 预算充值方式 */
            moneyOffMcInfoBean.setBudgetRechargeMethod(jsonTmpMoMcInfo.getBudgetRechargeMethod());
            /* 预算 */
            moneyOffMcInfoBean.setBudget(jsonTmpMoMcInfo.getBudget());
            /*银行出资预算*/
            moneyOffMcInfoBean.setBankBudget(jsonTmpMoMcInfo.getBankBudget());
            /*预期参与商户数量*/
            moneyOffMcInfoBean.setExpectMchntQty(jsonTmpMoMcInfo.getExpectMchntQty());
            /* 审批状态   */
            moneyOffMcInfoBean.setAuditStatus(tmPlatBizTmp.getAuditStatus());
            /* 创建人 */
            moneyOffMcInfoBean.setOprId(tmPlatBizTmp.getOprId());
            /* 创建时间 */
            moneyOffMcInfoBean.setCreateTime(tmPlatBizTmp.getCreateTime());
            /* 最后修改人 */
            moneyOffMcInfoBean.setLastOprId(tmPlatBizTmp.getLastOprId());
            /* 修改时间 */
            moneyOffMcInfoBean.setUpdateTime(tmPlatBizTmp.getLastUpdateTime());
            /* 审批拒绝原因 */
            moneyOffMcInfoBean.setAuditRefuseReason(tmPlatBizTmp.getAuditRefuseReason());
            /* 备用字段1 */
            moneyOffMcInfoBean.setRemark1(tmPlatBizTmp.getRemark1());
            /* 备用字段2 */
            moneyOffMcInfoBean.setRemark2(tmPlatBizTmp.getRemark2());
            /* 备用字段3 */
            moneyOffMcInfoBean.setRemark2(tmPlatBizTmp.getRemark3());
            /* 备用字段4 */
            moneyOffMcInfoBean.setRemark2(tmPlatBizTmp.getRemark4());
            /* 备用字段5 */
            moneyOffMcInfoBean.setRemark2(tmPlatBizTmp.getRemark5());
            /* 营销活动级别 0-非商户非银行级 1 商户级 2 银行级*/
            moneyOffMcInfoBean.setMcLvlCd(jsonTmpMoMcInfo.getMcLvlCd());
            /* 停车场业务标志 0-非停车场业务 1停车场业务*/
            moneyOffMcInfoBean.setPrkBusnFlg(jsonTmpMoMcInfo.getPrkBusnFlg());
            /* 普卡优惠次数*/
            moneyOffMcInfoBean.setOdcrdDisTimes(jsonTmpMoMcInfo.getOdcrdDisTimes());

        } catch (Exception e) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            e.printStackTrace(new PrintWriter(byteArrayOutputStream, true));
            rglog.error("转换营销活动信息异常,异常信息:<{}>", byteArrayOutputStream.toString());
            throw new BizException(RespCodeEnum.SYSTEM_ERROR.getRespCode(), RespCodeEnum.SYSTEM_ERROR.getRespDesc());
        }

        return moneyOffMcInfoBean;
    }

    /**
     * 营销活动机构信息数据库实体类和接口实体类数据转换
     *
     * @param mcOrgInfo 营销活动机构信息表
     * @return cc.rengu.igas.momp.facade.bean.McOrgInfoBean 营销活动机构信息对象
     * @author Jinan Liu
     * @date 2020/4/1 10:33
     */
    private McOrgInfoBean convertMcOrgInfo(TMMcOrgInfo mcOrgInfo) {
        McOrgInfoBean mcOrgInfoBean = new McOrgInfoBean();
        try {
            /* 机构编号 */
            mcOrgInfoBean.setOrgId(mcOrgInfo.getOrgId());
            /* 机构层级 */
            mcOrgInfoBean.setOrgHierarchy(mcOrgInfo.getOrgHierarchy());
            /* 机构名称 */
            mcOrgInfoBean.setOrgName(mcOrgInfo.getOrgName());

        } catch (Exception e) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            e.printStackTrace(new PrintWriter(byteArrayOutputStream, true));
            rglog.error("转换营销活动机构信息异常,异常信息:<{}>", byteArrayOutputStream.toString());
            throw new BizException(RespCodeEnum.SYSTEM_ERROR.getRespCode(), RespCodeEnum.SYSTEM_ERROR.getRespDesc());
        }

        return mcOrgInfoBean;
    }

    /**
     * 营销活动机构信息数据库临时表实体类和接口实体类数据转换
     *
     * @param tmPlatBizTmp 业务数据临时表
     * @return cc.rengu.igas.momp.facade.bean.McOrgInfoBean 营销活动机构信息对象
     * @author Jinan Liu
     * @date 2020/5/28 20:01
     */
    private McOrgInfoBean convertTmpMcOrgInfo(TMPlatBizTmp tmPlatBizTmp) {

        McOrgInfoBean mcOrgInfoBean = new McOrgInfoBean();
        try {

            JsonTmpMcOrgInfo jsonTmpMcOrgInfo = JsonOperation.parseTmpMcOrgInfoBizData1(tmPlatBizTmp, rglog);

            /* 机构编号 */
            mcOrgInfoBean.setOrgId(jsonTmpMcOrgInfo.getOrgId());
            /* 机构层级 */
            mcOrgInfoBean.setOrgHierarchy(jsonTmpMcOrgInfo.getOrgHierarchy());
            /* 机构名称 */
            mcOrgInfoBean.setOrgName(jsonTmpMcOrgInfo.getOrgName());

        } catch (Exception e) {
            rglog.error("转换临时表营销活动机构信息异常,异常信息:<{}>", StringUtil.ExceptionToString(e));
            throw new BizException(RespCodeEnum.SYSTEM_ERROR.getRespCode(), RespCodeEnum.SYSTEM_ERROR.getRespDesc());
        }

        return mcOrgInfoBean;
    }

    /**
     * 营销活动商户信息数据库实体类和接口实体类数据转换
     *
     * @param object 营销活动商户信息表
     * @return cc.rengu.igas.momp.facade.bean.McMchntInfoBean 营销活动商户信息对象
     * @author Jinan Liu
     * @date 2020/4/1 10:33
     */
    private McMchntInfoBean convertMcMchntInfo(Object object) {
        McMchntInfoBean mcMchntInfoBean = new McMchntInfoBean();
        TMMcMchntInfo mcMchntInfo = (TMMcMchntInfo) object;
        try {
            /* 商户范围类型 */
            mcMchntInfoBean.setMchntType(mcMchntInfo.getMchntType());
            /* 商户范围号 */
            mcMchntInfoBean.setMchntNo(mcMchntInfo.getMchntNo());
            /* 商户范围名称 */
            mcMchntInfoBean.setMchntName(mcMchntInfo.getMchntName());
            /* 新增商户标志 */
            mcMchntInfoBean.setNewMchntFlag(mcMchntInfo.getNewMchntFlag());
            /* 退出标志 */
            mcMchntInfoBean.setExitFlag(mcMchntInfo.getExitFlag());
            /* 操作类型 */
            if ((mcMchntInfo.getNewMchntFlag().equals(CommonConstant.MCHNT_REFUSE_FLAG) || mcMchntInfo.getNewMchntFlag().equals(CommonConstant.MCHNT_NEW_FLAG)) && mcMchntInfo.getExitFlag().equals(CommonConstant.MC_EXIT_FLAG)) {
                mcMchntInfoBean.setOprType(CommonConstant.BIZ_OPR_INSERT);
            } else {
                mcMchntInfoBean.setOprType(CommonConstant.EMPTY_STRING);
            }

        } catch (Exception e) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            e.printStackTrace(new PrintWriter(byteArrayOutputStream, true));
            rglog.error("转换营销活动商户信息异常,异常信息:<{}>", byteArrayOutputStream.toString());
            throw new BizException(RespCodeEnum.SYSTEM_ERROR.getRespCode(), RespCodeEnum.SYSTEM_ERROR.getRespDesc());
        }

        return mcMchntInfoBean;
    }

    /**
     * 营销活动商户信息数据库临时表实体类和接口实体类数据转换
     *
     * @param tmPlatBizTmp 业务数据临时表
     * @return cc.rengu.igas.momp.facade.bean.McMchntInfoBean 营销活动商户信息对象
     * @author Jinan Liu
     * @date 2020/5/28 20:13
     */
    private McMchntInfoBean convertTmpMcMchntInfo(TMPlatBizTmp tmPlatBizTmp) {

        McMchntInfoBean mcMchntInfoBean = new McMchntInfoBean();
        try {

            JsonTmpMcMchntInfo jsonTmpMcMchntInfo = JsonOperation.parseTmpMcMchntInfoBizData1(tmPlatBizTmp, rglog);

            /* 商户范围类型 */
            mcMchntInfoBean.setMchntType(jsonTmpMcMchntInfo.getMchntType());
            /* 商户范围号 */
            mcMchntInfoBean.setMchntNo(jsonTmpMcMchntInfo.getMchntNo());
            /* 商户范围名称 */
            mcMchntInfoBean.setMchntName(jsonTmpMcMchntInfo.getMchntName());
            if (tmPlatBizTmp.getAuditStatus().equals(AuditStatusEnum.NEW_AUDIT_PROCESSING.getAuditStatusCode()) || tmPlatBizTmp.getAuditStatus().equals(AuditStatusEnum.NEW_AUDIT_REJECT.getAuditStatusCode())
                    || tmPlatBizTmp.getAuditStatus().equals(AuditStatusEnum.PUBLISH_AUDIT_REJECT.getAuditStatusCode())) {
                /* 审批状态*/
                mcMchntInfoBean.setOprType(CommonConstant.BIZ_OPR_INSERT);
            } else {
                mcMchntInfoBean.setOprType(CommonConstant.EMPTY_STRING);
            }


        } catch (Exception e) {
            rglog.error("转换临时表营销活动机构信息异常,异常信息:<{}>", StringUtil.ExceptionToString(e));
            throw new BizException(RespCodeEnum.SYSTEM_ERROR.getRespCode(), RespCodeEnum.SYSTEM_ERROR.getRespDesc());
        }

        return mcMchntInfoBean;
    }

    /**
     * 营销活动用户规则信息数据库实体类和接口实体类数据转换
     *
     * @param mcUserInfo 营销活动用户信息表
     * @return cc.rengu.igas.momp.facade.bean.McUserInfoBean 营销活动用户信息对象
     * @author Jinan Liu
     * @date 2020/4/1 10:33
     */
    private McUserInfoBean convertMcUserInfo(TMMcUserInfo mcUserInfo) {
        McUserInfoBean mcUserInfoBean = new McUserInfoBean();
        try {
            /* 账户类型 */
            mcUserInfoBean.setAcctType(mcUserInfo.getAcctType());
            /* 账户 */
            mcUserInfoBean.setAcctNo(mcUserInfo.getAcctNo());
            /* 会员ID */
            mcUserInfoBean.setMemberId(mcUserInfo.getMemberId());
            /* 每日限制优惠次数 */
            mcUserInfoBean.setDayRestriction(mcUserInfo.getDayRestriction());
            /* 每周限制优惠次数 */
            mcUserInfoBean.setWeekRestriction(mcUserInfo.getWeekRestriction());
            /* 每月限制优惠次数 */
            mcUserInfoBean.setMonthRestriction(mcUserInfo.getMonthRestriction());
            /* 每季度限制优惠次数 */
            mcUserInfoBean.setQuerterRestriction(mcUserInfo.getQuerterRestriction());
            /* 每年限制优惠次数 */
            mcUserInfoBean.setYearRestriction(mcUserInfo.getYearRestriction());
            /* 活动期间优惠次数限制 */
            mcUserInfoBean.setRestriction(mcUserInfo.getRestriction());
            /** 账户标志 */
            mcUserInfoBean.setAcctFlag(mcUserInfo.getAcctFlag());

        } catch (Exception e) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            e.printStackTrace(new PrintWriter(byteArrayOutputStream, true));
            rglog.error("转换营销活动商户信息异常,异常信息:<{}>", byteArrayOutputStream.toString());
            throw new BizException(RespCodeEnum.SYSTEM_ERROR.getRespCode(), RespCodeEnum.SYSTEM_ERROR.getRespDesc());
        }

        return mcUserInfoBean;
    }

    /**
     * 营销活动用户信息数据库临时表实体类和接口实体类数据转换
     *
     * @param tmPlatBizTmp 业务数据临时表
     * @return cc.rengu.igas.momp.facade.bean.McUserInfoBean 营销活动用户信息对象
     * @author Jinan Liu
     * @date 2020/5/28 20:16
     */
    private McUserInfoBean convertTmpMcUserInfo(TMPlatBizTmp tmPlatBizTmp) {
        McUserInfoBean mcUserInfoBean = new McUserInfoBean();
        try {

            JsonTmpMcUserInfo jsonTmpMcUserInfo = JsonOperation.parseTmpMcUserInfoBizData1(tmPlatBizTmp, rglog);

            /* 账户类型 */
            mcUserInfoBean.setAcctType(jsonTmpMcUserInfo.getAcctType());
            /* 账户 */
            mcUserInfoBean.setAcctNo(jsonTmpMcUserInfo.getAcctNo());
            /* 会员ID */
            mcUserInfoBean.setMemberId(jsonTmpMcUserInfo.getMemberId());
            /* 每日限制优惠次数 */
            mcUserInfoBean.setDayRestriction(jsonTmpMcUserInfo.getDayRestriction());
            /* 每周限制优惠次数 */
            mcUserInfoBean.setWeekRestriction(jsonTmpMcUserInfo.getWeekRestriction());
            /* 每月限制优惠次数 */
            mcUserInfoBean.setMonthRestriction(jsonTmpMcUserInfo.getMonthRestriction());
            /* 每季度限制优惠次数 */
            mcUserInfoBean.setQuerterRestriction(jsonTmpMcUserInfo.getQuerterRestriction());
            /* 每年限制优惠次数 */
            mcUserInfoBean.setYearRestriction(jsonTmpMcUserInfo.getYearRestriction());
            /* 活动期间优惠次数限制 */
            mcUserInfoBean.setRestriction(jsonTmpMcUserInfo.getRestriction());

        } catch (Exception e) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            e.printStackTrace(new PrintWriter(byteArrayOutputStream, true));
            rglog.error("转换营销活动商户信息异常,异常信息:<{}>", byteArrayOutputStream.toString());
            throw new BizException(RespCodeEnum.SYSTEM_ERROR.getRespCode(), RespCodeEnum.SYSTEM_ERROR.getRespDesc());
        }

        return mcUserInfoBean;
    }

    /**
     * 营销活动时间规则信息数据库实体类和接口实体类数据转换
     *
     * @param mcTimeInfo 营销活动时间信息表
     * @return cc.rengu.igas.momp.facade.bean.McTimeInfoBean 营销活动事件对象
     * @author Jinan Liu
     * @date 2020/4/1 10:32
     */
    private McTimeInfoBean convertMcTimeInfo(TMMcTimeInfo mcTimeInfo) {
        McTimeInfoBean mcTimeInfoBean1 = new McTimeInfoBean();
        try {
            /* 顺序号 */
            mcTimeInfoBean1.setRuleIndex(mcTimeInfo.getRuleIndex());
            /* 星期一日期标志 */
            mcTimeInfoBean1.setFlagMonday(mcTimeInfo.getFlagMonday());
            /* 星期二日期标志 */
            mcTimeInfoBean1.setFlagTuesday(mcTimeInfo.getFlagTuesday());
            /* 星期三日期标志 */
            mcTimeInfoBean1.setFlagWednesday(mcTimeInfo.getFlagWednesday());
            /* 星期四日期标志 */
            mcTimeInfoBean1.setFlagThursday(mcTimeInfo.getFlagThursday());
            /* 星期五日期标志 */
            mcTimeInfoBean1.setFlagFriday(mcTimeInfo.getFlagFriday());
            /* 星期六日期标志 */
            mcTimeInfoBean1.setFlagSaturday(mcTimeInfo.getFlagSaturday());
            /* 星期日日期标志 */
            mcTimeInfoBean1.setFlagSunday(mcTimeInfo.getFlagSunday());
            /* 起始时间 */
            mcTimeInfoBean1.setStartTime(mcTimeInfo.getStartTime());
            /* 结束时间 */
            mcTimeInfoBean1.setEndTime(mcTimeInfo.getEndTime());

        } catch (Exception e) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            e.printStackTrace(new PrintWriter(byteArrayOutputStream, true));
            rglog.error("转换营销活动商户信息异常,异常信息:<{}>", byteArrayOutputStream.toString());
            throw new BizException(RespCodeEnum.SYSTEM_ERROR.getRespCode(), RespCodeEnum.SYSTEM_ERROR.getRespDesc());
        }

        return mcTimeInfoBean1;
    }

    /**
     * 营销活动时间信息数据库临时表实体类和接口实体类数据转换
     *
     * @param tmPlatBizTmp 业务数据临时表
     * @return cc.rengu.igas.momp.facade.bean.McTimeInfoBean 营销活动时间对象
     * @author Jinan Liu
     * @date 2020/5/28 20:24
     */
    private McTimeInfoBean convertTmpMcTimeInfo(TMPlatBizTmp tmPlatBizTmp) {
        McTimeInfoBean mcTimeInfoBean = new McTimeInfoBean();
        try {

            JsonTmpMcTimeInfo jsonTmpMcTimeInfo = JsonOperation.parseTmpMcTimeInfoBizData1(tmPlatBizTmp, rglog);

            /* 顺序号 */
            mcTimeInfoBean.setRuleIndex(jsonTmpMcTimeInfo.getRuleIndex());
            /* 星期一日期标志 */
            mcTimeInfoBean.setFlagMonday(jsonTmpMcTimeInfo.getFlagMonday());
            /* 星期二日期标志 */
            mcTimeInfoBean.setFlagTuesday(jsonTmpMcTimeInfo.getFlagTuesday());
            /* 星期三日期标志 */
            mcTimeInfoBean.setFlagWednesday(jsonTmpMcTimeInfo.getFlagWednesday());
            /* 星期四日期标志 */
            mcTimeInfoBean.setFlagThursday(jsonTmpMcTimeInfo.getFlagThursday());
            /* 星期五日期标志 */
            mcTimeInfoBean.setFlagFriday(jsonTmpMcTimeInfo.getFlagFriday());
            /* 星期六日期标志 */
            mcTimeInfoBean.setFlagSaturday(jsonTmpMcTimeInfo.getFlagSaturday());
            /* 星期日日期标志 */
            mcTimeInfoBean.setFlagSunday(jsonTmpMcTimeInfo.getFlagSunday());
            /* 起始时间 */
            mcTimeInfoBean.setStartTime(jsonTmpMcTimeInfo.getStartTime());
            /* 结束时间 */
            mcTimeInfoBean.setEndTime(jsonTmpMcTimeInfo.getEndTime());

        } catch (Exception e) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            e.printStackTrace(new PrintWriter(byteArrayOutputStream, true));
            rglog.error("转换营销活动商户信息异常,异常信息:<{}>", byteArrayOutputStream.toString());
            throw new BizException(RespCodeEnum.SYSTEM_ERROR.getRespCode(), RespCodeEnum.SYSTEM_ERROR.getRespDesc());
        }

        return mcTimeInfoBean;
    }

    /**
     * 营销活动规则信息数据库实体类和接口实体类数据转换
     *
     * @param mcMoneyOffRuleInfo 减免类营销活动规则表
     * @return cc.rengu.igas.momp.facade.bean.MoneyOffRuleInfoBean 减免类营销活动规则信息对象
     * @author Jinan Liu
     * @date 2020/4/1 10:32
     */
    private MoneyOffRuleInfoBean convertMcRuleInfo(TMMcMoneyOffRuleInfo mcMoneyOffRuleInfo) {

        MoneyOffRuleInfoBean moneyOffRuleInfoBean = new MoneyOffRuleInfoBean();

        try {

            /* 顺序号  */
            moneyOffRuleInfoBean.setRuleIndex(mcMoneyOffRuleInfo.getRuleIndex());
            /* 活动门槛 */
            moneyOffRuleInfoBean.setCriteria(mcMoneyOffRuleInfo.getCriteria());
            /* 优惠力度下限 */
            moneyOffRuleInfoBean.setDiscountFloor(mcMoneyOffRuleInfo.getDiscountFloor());
            /* 优惠力度上限 */
            moneyOffRuleInfoBean.setDiscountCelling(mcMoneyOffRuleInfo.getDiscountCelling());
            /* 总优惠数量 */
            moneyOffRuleInfoBean.setDiscountQuantity(mcMoneyOffRuleInfo.getDiscountQuantity());
            /* 单次优惠限制 */
            moneyOffRuleInfoBean.setDiscountLimit(mcMoneyOffRuleInfo.getDiscountLimit());
            /* 优惠总预算 */
            moneyOffRuleInfoBean.setBudget(mcMoneyOffRuleInfo.getBudget());
            /* 单日消耗预算 */
            moneyOffRuleInfoBean.setBudgetDayLimit(mcMoneyOffRuleInfo.getBudgetDayLimit());

        } catch (Exception e) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            e.printStackTrace(new PrintWriter(byteArrayOutputStream, true));
            rglog.error("转换营销活动规则信息异常,异常信息:<{}>", byteArrayOutputStream.toString());
            throw new BizException(RespCodeEnum.SYSTEM_ERROR.getRespCode(), RespCodeEnum.SYSTEM_ERROR.getRespDesc());
        }

        return moneyOffRuleInfoBean;
    }

    /**
     * 营销活动时间信息数据库临时表实体类和接口实体类数据转换
     *
     * @param tmPlatBizTmp 业务数据临时表
     * @return cc.rengu.igas.momp.facade.bean.MoneyOffRuleInfoBean 减免类营销活动规则信息对象
     * @author Jinan Liu
     * @date 2020/5/28 20:30
     */
    private MoneyOffRuleInfoBean convertTmpMcRuleInfo(TMPlatBizTmp tmPlatBizTmp) {

        MoneyOffRuleInfoBean moneyOffRuleInfoBean = new MoneyOffRuleInfoBean();

        try {

            JsonTmpMoMcRuleInfo jsonTmpMoMcRuleInfo = JsonOperation.parseTmpMoMcRuleInfoBizData1(tmPlatBizTmp, rglog);

            /* 顺序号  */
            moneyOffRuleInfoBean.setRuleIndex(jsonTmpMoMcRuleInfo.getRuleIndex());
            /* 活动门槛 */
            moneyOffRuleInfoBean.setCriteria(jsonTmpMoMcRuleInfo.getCriteria());
            /* 优惠力度下限 */
            moneyOffRuleInfoBean.setDiscountFloor(jsonTmpMoMcRuleInfo.getDiscountFloor());
            /* 优惠力度上限 */
            moneyOffRuleInfoBean.setDiscountCelling(jsonTmpMoMcRuleInfo.getDiscountCelling());
            /* 总优惠数量 */
            moneyOffRuleInfoBean.setDiscountQuantity(jsonTmpMoMcRuleInfo.getDiscountQuantity());
            /* 单次优惠限制 */
            moneyOffRuleInfoBean.setDiscountLimit(jsonTmpMoMcRuleInfo.getDiscountLimit());
            /* 优惠总预算 */
            moneyOffRuleInfoBean.setBudget(jsonTmpMoMcRuleInfo.getBudget());
            /* 单日消耗预算 */
            moneyOffRuleInfoBean.setBudgetDayLimit(jsonTmpMoMcRuleInfo.getBudgetDayLimit());

        } catch (Exception e) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            e.printStackTrace(new PrintWriter(byteArrayOutputStream, true));
            rglog.error("转换营销活动规则信息异常,异常信息:<{}>", byteArrayOutputStream.toString());
            throw new BizException(RespCodeEnum.SYSTEM_ERROR.getRespCode(), RespCodeEnum.SYSTEM_ERROR.getRespDesc());
        }

        return moneyOffRuleInfoBean;
    }

    /**
     * 营销活动支付产品信息数据库实体类和接口实体类数据转换
     *
     * @param mcProductInfo 营销活动产品信息表
     * @return cc.rengu.igas.momp.facade.bean.McProductInfoBean 营销活动产品对象
     * @author Jinan Liu
     * @date 2020/4/1 10:32
     */
    private McProductInfoBean convertMcProductInfo(TMMcProductInfo mcProductInfo) {
        McProductInfoBean mcProductInfoBean = new McProductInfoBean();
        try {
            /* 业务产品代码 */
            mcProductInfoBean.setBizProdCode(mcProductInfo.getBizProdCode());

        } catch (Exception e) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            e.printStackTrace(new PrintWriter(byteArrayOutputStream, true));
            rglog.error("转换营销活动支付产品信息异常,异常信息:<{}>", byteArrayOutputStream.toString());
            throw new BizException(RespCodeEnum.SYSTEM_ERROR.getRespCode(), RespCodeEnum.SYSTEM_ERROR.getRespDesc());
        }

        return mcProductInfoBean;
    }

    /**
     * 营销活动产品信息数据库临时表实体类和接口实体类数据转换
     *
     * @param tmPlatBizTmp 业务数据临时表
     * @return cc.rengu.igas.momp.facade.bean.McProductInfoBean 营销活动产品对象
     * @author Jinan Liu
     * @date 2020/5/28 20:29
     */
    private McProductInfoBean convertTmpMcProductInfo(TMPlatBizTmp tmPlatBizTmp) {
        McProductInfoBean mcProductInfoBean = new McProductInfoBean();
        try {

            JsonTmpMcProdInfo jsonTmpMcProdInfo = JsonOperation.parseTmpMcProdInfoBizData1(tmPlatBizTmp, rglog);

            /* 业务产品代码 */
            mcProductInfoBean.setBizProdCode(jsonTmpMcProdInfo.getBizProdCode());

        } catch (Exception e) {
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            e.printStackTrace(new PrintWriter(byteArrayOutputStream, true));
            rglog.error("转换营销活动支付产品信息异常,异常信息:<{}>", byteArrayOutputStream.toString());
            throw new BizException(RespCodeEnum.SYSTEM_ERROR.getRespCode(), RespCodeEnum.SYSTEM_ERROR.getRespDesc());
        }

        return mcProductInfoBean;
    }

    /**
     * 使用商户编号从内管商户基本信息表查询商户所属商圈编号
     *
     * @param globalInstId 法人机构号
     * @param mchntNo      商户编号
     * @return cc.rengu.igas.momp.common.entity.TBMchntBaseInfo 商户基本信息表T_B_MCHNT_BASE_INFO
     * @throws Exception 异常信息
     * @author Jinan Liu
     * @date 2020/5/28 13:06
     */
    private TBMchntBaseInfo selectMompMchntBaseInfoByPrimaryKey(String globalInstId, String mchntNo) throws Exception {

        MchntInfoMapper mchntInfoMapper = new MchntInfoMapperImpl();
        return mchntInfoMapper.selectMompMchntBaseInfoByPrimaryKey(globalInstId, mchntNo);
    }

}
